//
//  ByViewNickNameTF.m
//  itboye_shop_ios
//
//  Created by justiOS on 17/2/13.
//  Copyright © 2017年 com.itboye. All rights reserved.
//

#import "ByViewNickNameTF.h"

@implementation ByViewNickNameTF

// 自定义初始化方法
- (instancetype)initWithFrame:(CGRect)frame placeholder:(NSString *)placeholder
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        // 设置圆角
        self.layer.cornerRadius = 5;
        // 设置边框
        self.layer.borderWidth = 0.5;
        self.layer.borderColor = [UIColor lightGrayColor].CGColor;
        // 设置代理
        //self.delegate = self;
        // 提示文字
        NSDictionary *attrDic = @{NSFontAttributeName:[UIFont systemFontOfSize:15]};
        NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:placeholder attributes:attrDic];
        self.attributedPlaceholder = attrString;
        
    }
    return self;
}

//控制 placeHolder 的位置，左右缩 20
- (CGRect)textRectForBounds:(CGRect)bounds {
    return CGRectInset( bounds , 10 , 0 );
}

// 控制文本的位置，左右缩 20
- (CGRect)editingRectForBounds:(CGRect)bounds {
    return CGRectInset( bounds , 10 , 0 );
}
@end
